package com.qys.livesMall.anchor.controller.sys;


import com.qys.livesMall.anchor.model.dto.H2AnchorApproveDTO;
import com.qys.livesMall.anchor.scheduledTask.OrderAnchorStatisticsTask;
import com.qys.livesMall.anchor.service.H2AnchorApplyService;
import com.qys.livesMall.common.result.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 主播申请信息后台管理
 *
 * @author yxh
 * @since 2023-06-16 09:46:14
 */
@RestController
@RequestMapping("/sys/anchor/apply")
@Tag(name = "App-主播申请后台管理", description = "App-主播申请后台管理")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class H2AnchorApplyController {

    private final H2AnchorApplyService h2AnchorApplyService;
    private final OrderAnchorStatisticsTask statisticsTask;

    /**
     * 审批申请
     *
     * @param dto 申请审批对象
     * @return 审批结果
     */
    @PostMapping("/approve")
    @Operation(summary = "审批申请")
    public R<?> approve(@RequestBody H2AnchorApproveDTO dto) {
        return h2AnchorApplyService.approve(dto);
    }

    @PostMapping("/test")
    @Operation(summary = "测试")
    public void test(){
        statisticsTask.getOrderAnchorStatistics();
    }

}

